package com.example.myapplication.navigation.fragment;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentFourBinding;
import com.example.myapplication.utils.NameCreator;

/**
 * A simple {@link Fragment} subclass.
 * create an instance of this fragment.
 */
public class FourFragment extends BaseLifeFragment {

    FragmentFourBinding binding;
    public FourFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        View view=inflater.inflate(R.layout.fragment_four, container, false);
        binding=FragmentFourBinding.bind(view);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        binding.fourFragmentBtnGoNewThirdFragment.setOnClickListener(v ->
                NavHostFragment.findNavController(FourFragment.this).navigate(R.id.action_fourFragment_to_ThirdFragment));
    }

    @Override
    public String initLogHead() {
        return NameCreator.getInstance().getName("***********************FourFragment", hashCode());
    }
}
